<template>
	<view class="agreement">
		<m-richtext v-if="agreement.content" :content="agreement.content"></m-richtext>
		<view v-else class="data-null"><text>暂无协议内容</text></view>
	</view>
</template>

<script>
	export default {
		name: "m-agreement",
		data() {
			return {
				agreement: {},
			};
		},
		props: {
			type: {
				type: String,
				default: 'index'
			},
		},
		async mounted() {
			await this.agreementDataLoadHandleFunc();
		},
		methods: {
			async agreementDataLoadHandleFunc(){
				console.log(this);
				let response = await this.http({
					url: 'material/details',
					data: {key: this.type}
				});
				if(response.status !== 0){
					return false;
				}
				uni.setNavigationBarTitle({
					title: response.result.title
				});
				this.agreement = response.result;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.agreement{
		padding: 30rpx;
		.data-null{
			padding:  100rpx 0;
			text-align: center;
			font-size: 24rpx;
			color: #888;
		}
	}
</style>
